<?php
require("../config.php");
require_once($CONF['root.dir']."database.php");

if(strtoupper($_GET["modul"])=="EDIT"){
	$SQL="SELECT id_pelamar, nama, tmp_lahir,tgl_lahir, hasil_test,id_test FROM tbltes
		  where id_test='".$_GET["data"]."'";
	$conn->connect();
	$val=$conn->query($SQL);
	$val->next();
	
	$id_pelamar     = $val->get(0);
	$nama 		 	= $val->get(1);
	$tmp_lahir 		= $val->get(2);
	$tgl_lahir 		= $val->get(3);
	$hasil_test 	= $val->get(4);
	if($hasil_test=="Lulus"){
		$opthtest=' <option value="Lulus" selected="selected">Lulus</option>
                <option value="Tidak Lulus">Tidak Lulus</option>';
	}else{
		$opthtest=' <option value="Lulus">Lulus</option>
                <option value="Tidak Lulus" selected="selected">Tidak Lulus</option>';
	}
				
	$BUTTON="Update";
	$conn->connect();
}else{
	$BUTTON="Save";
	$opthtest=' <option value="Lulus">Lulus</option>
                <option value="Tidak Lulus">Tidak Lulus</option>';
}	
?>
<fieldset class="fieldbox">
<legend class="fieldbox">Form Hasil Tes</legend>
<form id="frmtest" name="frmtest" method="post" onsubmit="return SaveForm('frmtest','SubModules/postTes.php');" autocomplete="off">
<input type="hidden" name="ACTION" id="ACTION" value="<?php echo $BUTTON?>" />
<input type="hidden" name="DATA" id="DATA" value="<?php echo $_GET["data"]?>" />
<table width="100%" border="0" cellpadding="2px" cellspacing="1px">
<tr><td>
   <table width="100%" border="0" cellpadding="3px" cellspacing="0">
    	<tr>	
            <td width="30%">ID Pelamar</td>
            <td width="3%">:</td>
            <td width="70%"><input type="text" id="id_pelamar" name="id_pelamar" size="35" value="<?php echo $id_pelamar ?>" class="required" readonly="readonly"/></td>
        </tr>
        <tr>	
            <td width="30%">Nama</td>
            <td width="3%">:</td>
            <td width="70%"><input type="text" id="nama" name="nama" size="35" value="<?php echo $nama ?>" class="required" readonly="readonly"/></td>
        </tr>
        <tr>
            <td width="30%">Tempat Lahir</td>
            <td width="3%">:</td>
            <td width="70%"><input type="text" id="tmp_lahir" name="tmp_lahir" size="35" value="<?php echo $tmp_lahir ?>" class="required" readonly="readonly"/></td>
        </tr>
        <tr>
            <td width="30%">Tanggal Lahir</td>
            <td width="3%">:</td>
            <td width="70%"><input type="text" id="tgl_lahir" name="tgl_lahir" size="35" value="<?php echo $tgl_lahir ?>"  class="required" readonly="readonly"/></td>
        </tr>
       
        <tr>
            <td width="30%">Hasil Tes</td>
            <td width="3%">:</td>
            <td width="70%">
            <select name="hasil_test">
           <?php echo $opthtest ?>
            </select>
            </td>
        </tr>
       
	 </table>
	</td></tr>
	<tr><td>&nbsp;</td></tr>
  	<tr>
       <td>
               <input type="submit" value="Save" style="display:none;" />
            	<a href="javascript:void(0)" onclick="return SaveForm('frmtest','SubModules/postTes.php');"
                		class="fg-button fg-button-icon-left ui-corner-all fg-button-bg">
                    <span class="ui-icon ui-icon-disk"></span>
                    <?php echo $BUTTON ?>
                </a>
                <a href="javascript:void(0)" onclick="ResetForm('#result','frmtest')" 
                		class="fg-button fg-button-icon-left ui-corner-all fg-button-bg">
                    <span class="ui-icon ui-icon-closethick"></span>
                    Clear
                </a>
            </td>
        </tr>
		<tr><td>&nbsp;</td></tr>
</table>
</form>
<div id="result" style="display:none;" class=""></div>
</fieldset>
